﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SaleInvoiceBillLevel.aspx.cs" Inherits="Main_Inventory_SaleInvoiceBillLevel" Culture="en-GB"%>
<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Sale Invoice</title>
    <link rel="Stylesheet" href="../../Styles/accounts.css" type="text/css" />
    <script src="../../JavaScript/Commons.js" type="text/javascript"></script>
   <%-- <script src="../../Menu/js/jquery.min.js" type="text/javascript"></script>  --%>
   <script src="../../JavaScript/jquery-1.4.2.min.js" type="text/javascript"></script>
   
    <script type="text/javascript">
        function GetQuantity(hidItemId, CtrlId, HidLocationId) {
            if (hidItemId != '' && parseFloat(hidItemId) > 0) {
                var ctrlIndex = HidLocationId.toString();                             
                var LocationIdandQty = document.getElementById(ctrlIndex).value;
                window.open('WinSaleQty.aspx?ItemId=' + hidItemId + '&CtrlId=' + CtrlId + '&HidLocationId=' + HidLocationId + '&LocationIdandQty=' + LocationIdandQty, '', 'width=700, height=400, resizable=0');
            }
            else {
                alert('Choose Item First');
                return false;
            }
        }

        function CalculateAmtBillLevel() {
            var Count = document.getElementById("hidControlBillLevel").value;
            var TotalQty = 0;
            var TotalAmount = 0;
            var TotalTax = 0;
            for (var i = 1; i <= Count; i++) {
                var Qty = document.getElementById("txtQuantityBillLevel" + i);
                var RateAmt = document.getElementById("txtRateBillLevel" + i);
                var TaxRate = document.getElementById("hidTaxRateBillLevel" + i);
                var TaxAmount = document.getElementById("hidTaxAmtBillLevel" + i);
                var ItemAmount = document.getElementById("txtAmountBillLevel" + i);
                var itemAmt = 0;
                var taxAmt = 0;
                if (Qty.value != '' && parseFloat(Qty.value) > 0) {
                    TotalQty += parseFloat(Qty.value);
                    if (RateAmt.value != '' && parseFloat(RateAmt.value) > 0) {                        
                        itemAmt = parseFloat(Qty.value) * parseFloat(RateAmt.value);
                        TotalAmount += parseFloat(itemAmt);
                        
                        if (TaxRate.value != '' && parseFloat(TaxRate.value) > 0) {
                            taxAmt = (parseFloat(itemAmt) * parseFloat(TaxRate.value)) / 100;
                        }
                        TotalTax += parseFloat(taxAmt);
                    }
                    document.getElementById("txtAmountBillLevel" + i).value = parseFloat(itemAmt).toFixed(2);
                    document.getElementById("hidTaxAmtBillLevel" + i).value = parseFloat(taxAmt).toFixed(2);
                }                
            }
            var grossTotal = TotalAmount + TotalTax;
            document.getElementById("txtTotalItemBillLevel").value = TotalQty.toFixed(2);
            document.getElementById("txtPreTaxBillLevel").value = TotalAmount.toFixed(2);
            document.getElementById("txtTaxableAmtBillLevel").value = TotalAmount.toFixed(2);
            document.getElementById("txtVatBillLevel").value = TotalTax.toFixed(2);
            document.getElementById("txtPostTaxBillLevel").value = grossTotal.toFixed(2);
            var roundOff = 0;
            roundOff = document.getElementById("txtRoundOffBillLevel").value;
            if (roundOff == '') {
                roundOff = 0;
            }
            var GrandTotal = grossTotal + parseFloat(roundOff) ;            
            document.getElementById("txtGrandTotalBillLevel").value = GrandTotal.toFixed(2);
        }
        function EnabledTabKey(id, e) {
            var keycode;
            if (window.event) {
                keycode = window.event.keyCode;
            }
            else if (e) {
                keycode = e.which;
            }
            else {
                return true;
            }

            if (keycode == 9) {
                // if is the tab key                
                return true;
            }
            else {
                return false;
            }
        }

        function roundOff() {
            var postTotal = 0;            
            var roundOff = 0;
            postTotal = document.getElementById("txtPostTaxBillLevel").value;
            roundOff = document.getElementById("txtRoundOffBillLevel").value;
            if (postTotal == '') {
                postTotal = 0;
            }
            if (roundOff == '') {
                roundOff = 0;
            }
            var GrandTotal = parseFloat(postTotal) + parseFloat(roundOff);
            document.getElementById("txtGrandTotalBillLevel").value = GrandTotal.toFixed(2);        
        }
    
    </script>  
<style type="text/css">   
#wrapper {
    width:110%;
    margin-left:5%;
    margin-top:15px;
}
ul.tabs {
    width:99%;
    margin:0;
    padding:0;
}
ul.tabs li {
    display:block;
    float:left;
    padding:0 5px;
}
ul.tabs li a {
    display:block;
    float:left;
    padding:5px;
    font-size:0.8em;
    background-color:#e0e0e0;
    color:#666;
    text-decoration:none;
}
.selected {
    font-weight:bold;
}
.tab-content {
	clear:both;
    border:1px solid #ddd;
    padding:10px;
}
</style>

<script type="text/javascript">

    $(document).ready(function() {

        $('.tabs a').click(function() {
            switch_tabs($(this));
        });

        switch_tabs($('.defaulttab'));

    });

    function switch_tabs(obj) {
        $('.tab-content').hide();
        $('.tabs a').removeClass("selected");
        var id = obj.attr("rel");

        $('#' + id).show();
        obj.addClass("selected");
    }

</script>
    
    
</head>
<body >
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
    <acc:heading ID="pagehead" runat="server" HeadingText="Sale Invoice" />   
     <asp:Panel ID="PnlAddNew" runat="server" Visible="false">  
     <div style="margin-left:5%; margin-right:5%; width:90%" align="center">
        <asp:Label ID="lblMsg" runat="server" Font-Bold="true"></asp:Label>
     </div>        
        <div style="width:90%; margin-left:5%; margin-right:5%; margin-top:20px;">        
          <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>--%>
                    <table class="tablecontent" style="width:100%">
                        <tr>
                            <td class="headtd" colspan="4">
                               Sale Invoice
                           </td>
                        </tr>
                        <tr >
                            <td style="width:12%">
                                Bill Format<span style="color:Red">*</span>
                                <asp:HiddenField ID="hidTaxLevel" runat="server" />
                            </td>
                            <td style="width:35%;">
                                <asp:DropDownList ID="ddlFormat" runat="server" Width="175px" CssClass="dropdown" OnSelectedIndexChanged="ddlFormat_OnSelectedIndexChanged"  AutoPostBack="true"></asp:DropDownList>                                
                                <asp:RequiredFieldValidator ID="reqFormat" runat="server" ControlToValidate="ddlFormat" ValidationGroup="V" InitialValue="0" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>
                            </td>
                            <td style="width:12%">
                                Customer<span style="color:Red">*</span>
                            </td>
                            <td style="width:41%">
                                <asp:DropDownList ID="ddlCustomer" runat="server" Width="240px" CssClass="dropdown"></asp:DropDownList>                               
                                <asp:RequiredFieldValidator ID="reqSupplier" runat="server" ControlToValidate="ddlCustomer" InitialValue="0" ValidationGroup="V" SetFocusOnError="true" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>
                            </td>
                         </tr>
                        <tr >
                            <td>
                                Bill No.<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:TextBox ID="txtPrefix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="prefixWater" runat="server" TargetControlID="txtPrefix" WatermarkText="Prefix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                                <asp:TextBox ID="txtVoucher" runat="server" Width="70px" CssClass="inputnumber" ValidationGroup="V" MaxLength="10" ></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="voucherWater" runat="server" TargetControlID="txtVoucher" WatermarkText="Number" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>                            
                                <asp:TextBox ID="txtSuffix" runat="server" Width="70px" CssClass="input" onKeyPress="return false" onKeydown="return false"></asp:TextBox>
                                <AjaxControl:TextBoxWatermarkExtender ID="suffixWater" runat="server" TargetControlID="txtSuffix" WatermarkText="Suffix" WatermarkCssClass="watermark_textbox"></AjaxControl:TextBoxWatermarkExtender>
                                <asp:RequiredFieldValidator ID="reqVoucher" runat="server" SetFocusOnError="true" ControlToValidate="txtVoucher" ValidationGroup="V" ErrorMessage="*" Display="Dynamic"></asp:RequiredFieldValidator>
                            </td>                            
                            <td >
                                Tax Group<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:DropDownList ID="ddlTaxGroup" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlTaxGroup_OnSelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>  
                                <asp:RequiredFieldValidator ID="reqTaxGroup" runat="server" ControlToValidate="ddlTaxGroup" InitialValue="0" ValidationGroup="V" ErrorMessage="*" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>                                                          <%--<asp:RequiredFieldValidator ID="reqTaxGroup" runat="server" InitialValue="0" SetFocusOnError="true" ControlToValidate="ddlTaxGroup" ValidationGroup="V" Display="Dynamic"></asp:RequiredFieldValidator>--%>&nbsp;
                                
                            </td>
                        </tr>
                        <tr >
                            <td >
                                Date<span style="color:Red">*</span>
                            </td>
                            <td >
                                <asp:TextBox ID="txtDate" runat="server" Width="120px" CssClass="input" ValidationGroup="V"></asp:TextBox>                                
                                <asp:ImageButton ID="btnDate" runat="server" ImageUrl="~/Images/calendar.gif" />
                                <AjaxControl:CalendarExtender ID="cal" runat="server" PopupButtonID="btnDate" TargetControlID="txtDate" Format="dd/MM/yyyy"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskExt" runat="server" MaskType="Date" Mask="99/99/9999" TargetControlID="txtDate" CultureName="pt-BR"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValid" runat="server" ControlExtender="maskExt" InvalidValueMessage="Invalid Date" IsValidEmpty="true" Display="Dynamic" ValidationGroup="V" ControlToValidate="txtDate"></AjaxControl:MaskedEditValidator>                             
                                <asp:RequiredFieldValidator ID="reqDate" runat="server" ControlToValidate="txtDate" ValidationGroup="V" ErrorMessage="*" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>&nbsp;
                            </td>
                            <td >
                               Cash/Credit                             
                            </td>
                            <td>
                                <div style="float:left"> 
                                    <asp:RadioButtonList ID="rbtCashCredit" runat="server" RepeatDirection="Horizontal">
                                        <asp:ListItem Text="Cash" Value="0" Selected="True"></asp:ListItem>
                                        <asp:ListItem Text="Credit" Value="1"></asp:ListItem>
                                    </asp:RadioButtonList>
                                </div> 
                                <div style="float:left"> 
                                    &nbsp;<asp:TextBox ID="txtCreditDay" runat="server" onKeyPress="return isNumberKey(this.id,event)" Width="60px" CssClass="inputnumber" MaxLength="3"></asp:TextBox>&nbsp;Days                                                           
                                </div>
                                
                                
                                <%--<asp:RequiredFieldValidator ID="reqBillRef" runat="server" ControlToValidate="txtBillRef1" ValidationGroup="V" SetFocusOnError="true" Display="Dynamic"></asp:RequiredFieldValidator>--%>
                                
                            </td>
                        </tr>
                        <tr>
                            <td>
                                S.O. Ref:  
                            </td>
                            <td>
                                <asp:TextBox ID="txtBillRef1" runat="server" Width="90px" CssClass="input" ValidationGroup="V" MaxLength="20"></asp:TextBox>
                                <asp:TextBox ID="txtBillRef2" runat="server" Width="80px" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                <AjaxControl:CalendarExtender ID="extCalbill" runat="server" Format="dd/MM/yyyy" TargetControlID="txtBillRef2"></AjaxControl:CalendarExtender>
                                <AjaxControl:MaskedEditExtender ID="maskRefDate" runat="server" Mask="99/99/9999" TargetControlID="txtBillRef2" MaskType="Date" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                <AjaxControl:MaskedEditValidator ID="maskValidRef" runat="server" ControlExtender="maskRefDate" ControlToValidate="txtBillRef2" ValidationGroup="V" InvalidValueMessage="*"></AjaxControl:MaskedEditValidator>
                            </td>
                        </tr>
                    </table>
          <%--  </ContentTemplate>
         </asp:UpdatePanel> --%> 
        </div> 
          
       
        <asp:Panel ID="panelBillLevel" runat="server" Width="85%">
            <div id="wrapper">    
                <ul class="tabs">
                    <li><a href="javascript:void(0)" class="defaulttab" rel="tabGeneralBillLevel">General</a></li>
                    <li><a href="javascript:void(0)" rel="tabOtherBillLevel">Other</a></li>                   
                </ul>    
            <div class="tab-content" id="tabGeneralBillLevel" runat="server">
            <%--<asp:UpdatePanel ID="UpdatePanel2" runat="server">           
            <ContentTemplate> --%>           
                <div style="width:100%">
                 <asp:HiddenField ID="hidControlBillLevel" Value="5" runat="server" />                 
                 <table id="tblBillLevel" runat="server" style="width:100%" class="tablecontent" cellpadding="2" cellspacing="0">
                    <tr>
                        <td style ="width:25%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Item(s)</td>
                        <td style ="width:15%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Unit</td>
                        <td style ="width:20%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Quantity</td>
                        <td style ="width:10px; border-right:1px solid #818181; border-bottom:1px solid #818181;" class="headtd">&nbsp;</td>
                        <td style ="width:20%; border-right:1px solid #818181; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Rate</td>                                               
                        <td style ="width:20%; border-bottom:1px solid #818181; text-align:center; font-weight:bold" class="headtd">Amount</td>                        
                    </tr>   
                        <tr>
                            <td style="width:25%; vertical-align:top"> 
                                <asp:DropDownList ID="ddlItemBillLevel1" runat="server" Width="98%" AutoPostBack="true" OnSelectedIndexChanged="ddlItemBillLevel_SelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                
                            </td>
                            <td style="width:15%; vertical-align:top">
                                <asp:TextBox ID="txtUnitBillLevel1" runat="server" CssClass="input" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>                           
                                <asp:HiddenField ID="hidUnitIdBillLevel1" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">                            
                                <asp:TextBox ID="txtQuantityBillLevel1" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  Width="99%"></asp:TextBox>                            
                            </td>
                            <td style="width:10px; vertical-align:top">
                                <asp:Button ID="btnQtyBillLevel1" runat="server" Text="..."  CssClass="button" Width="98%" />
                                <asp:HiddenField ID="hidLocationBillLevel1" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtRateBillLevel1" runat="server" CssClass="inputnumber" Width="98%" onKeyPress="return isNumberKey(this.id,event);" onblur="return CalculateAmtBillLevel();" AutoCompleteType="Disabled"></asp:TextBox>
                                <asp:HiddenField ID="hidTaxRateBillLevel1" runat="server" />
                                <asp:HiddenField ID="hidTaxAmtBillLevel1" runat="server" />
                            </td>                             
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtAmountBillLevel1" runat="server" CssClass="inputnumber" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled"></asp:TextBox>
                            </td>
                        </tr>  
                        <tr>
                            <td style="width:25%; vertical-align:top"> 
                                <asp:DropDownList ID="ddlItemBillLevel2" runat="server" Width="98%" AutoPostBack="true" OnSelectedIndexChanged="ddlItemBillLevel_SelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                
                            </td>
                            <td style="width:15%; vertical-align:top">
                                <asp:TextBox ID="txtUnitBillLevel2" runat="server" CssClass="input" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>                           
                                <asp:HiddenField ID="hidUnitIdBillLevel2" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">                            
                                <asp:TextBox ID="txtQuantityBillLevel2" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  Width="99%"></asp:TextBox>                            
                            </td>
                            <td style="width:10px; vertical-align:top">
                                <asp:Button ID="btnQtyBillLevel2" runat="server" Text="..." CssClass="button" Width="98%" />
                                <asp:HiddenField ID="hidLocationBillLevel2" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtRateBillLevel2" runat="server" CssClass="inputnumber" Width="98%" onKeyPress="return isNumberKey(this.id,event);"  onblur="return CalculateAmtBillLevel();"  AutoCompleteType="Disabled"></asp:TextBox>
                                <asp:HiddenField ID="hidTaxRateBillLevel2" runat="server" />
                                <asp:HiddenField ID="hidTaxAmtBillLevel2" runat="server" />
                            </td>                             
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtAmountBillLevel2" runat="server" CssClass="inputnumber" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled"></asp:TextBox>
                            </td>
                        </tr>      
                        <tr>
                            <td style="width:25%; vertical-align:top"> 
                                <asp:DropDownList ID="ddlItemBillLevel3" runat="server" Width="98%" AutoPostBack="true" OnSelectedIndexChanged="ddlItemBillLevel_SelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                
                            </td>
                            <td style="width:15%; vertical-align:top">
                                <asp:TextBox ID="txtUnitBillLevel3" runat="server" CssClass="input" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>                           
                                <asp:HiddenField ID="hidUnitIdBillLevel3" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">                            
                                <asp:TextBox ID="txtQuantityBillLevel3" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  Width="99%"></asp:TextBox>                            
                            </td>
                            <td style="width:10px; vertical-align:top">
                                <asp:Button ID="btnQtyBillLevel3" runat="server" Text="..." CssClass="button" Width="98%" />
                                <asp:HiddenField ID="hidLocationBillLevel3" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtRateBillLevel3" runat="server" CssClass="inputnumber" Width="98%" onKeyPress="return isNumberKey(this.id,event);"  onblur="return CalculateAmtBillLevel();"  AutoCompleteType="Disabled"></asp:TextBox>
                                <asp:HiddenField ID="hidTaxRateBillLevel3" runat="server" />
                                <asp:HiddenField ID="hidTaxAmtBillLevel3" runat="server" />
                            </td>                             
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtAmountBillLevel3" runat="server" CssClass="inputnumber" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled"></asp:TextBox>
                            </td>
                        </tr>  
                        <tr>
                            <td style="width:25%; vertical-align:top"> 
                                <asp:DropDownList ID="ddlItemBillLevel4" runat="server" Width="98%" AutoPostBack="true" OnSelectedIndexChanged="ddlItemBillLevel_SelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                
                            </td>
                            <td style="width:15%; vertical-align:top">
                                <asp:TextBox ID="txtUnitBillLevel4" runat="server" CssClass="input" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>                           
                                <asp:HiddenField ID="hidUnitIdBillLevel4" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">                            
                                <asp:TextBox ID="txtQuantityBillLevel4" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  Width="99%"></asp:TextBox>                            
                            </td>
                            <td style="width:10px; vertical-align:top">
                                <asp:Button ID="btnQtyBillLevel4" runat="server" Text="..." CssClass="button" Width="98%" />
                                <asp:HiddenField ID="hidLocationBillLevel4" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtRateBillLevel4" runat="server" CssClass="inputnumber" Width="98%" onKeyPress="return isNumberKey(this.id,event);"  onblur="return CalculateAmtBillLevel();"  AutoCompleteType="Disabled"></asp:TextBox>
                                <asp:HiddenField ID="hidTaxRateBillLevel4" runat="server" />
                                <asp:HiddenField ID="hidTaxAmtBillLevel4" runat="server" />
                            </td>                             
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtAmountBillLevel4" runat="server" CssClass="inputnumber" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled"></asp:TextBox>
                            </td>
                        </tr> 
                        <tr>
                            <td style="width:25%; vertical-align:top"> 
                                <asp:DropDownList ID="ddlItemBillLevel5" runat="server" Width="98%" AutoPostBack="true" OnSelectedIndexChanged="ddlItemBillLevel_SelectedIndexChanged" CssClass="dropdown"></asp:DropDownList>                                                
                            </td>
                            <td style="width:15%; vertical-align:top">
                                <asp:TextBox ID="txtUnitBillLevel5" runat="server" CssClass="input" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>                           
                                <asp:HiddenField ID="hidUnitIdBillLevel5" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">                            
                                <asp:TextBox ID="txtQuantityBillLevel5" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  Width="99%"></asp:TextBox>                            
                            </td>
                            <td style="width:10px; vertical-align:top">
                                <asp:Button ID="btnQtyBillLevel5" runat="server" Text="..." CssClass="button" Width="98%" />
                                <asp:HiddenField ID="hidLocationBillLevel5" runat="server" />
                            </td>
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtRateBillLevel5" runat="server" CssClass="inputnumber" Width="98%" onKeyPress="return isNumberKey(this.id,event);"  onblur="return CalculateAmtBillLevel();"  AutoCompleteType="Disabled"></asp:TextBox>
                                <asp:HiddenField ID="hidTaxRateBillLevel5" runat="server" />
                                <asp:HiddenField ID="hidTaxAmtBillLevel5" runat="server" />
                            </td>                             
                            <td style="width:20%; vertical-align:top">
                                <asp:TextBox ID="txtAmountBillLevel5" runat="server" CssClass="inputnumber" Width="98%" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled"></asp:TextBox>
                            </td>
                        </tr>             
                    </table>
                    <table style="width:98%; margin:5px;" align="right" >
                        <tr>
                            <td>                             
                                <asp:LinkButton ID="btnAddMoreBillLevel" runat="server" OnClick="btnAddMoreBillLevel_Click"> 
                                    <img src="../../Images/More.jpg" alt="Add New Row" />
                                </asp:LinkButton> 
                            </td>
                        </tr>
                </table>
             </div>                    
                <div style="width:100%"> 
                <div style="width:50%; float:left" align="left">
                    <table>
                        <tr>
                            <td>
                                Sales Ledger :
                            </td>
                             <td>
                                <asp:DropDownList ID="ddlSaleLedger" runat="server" CssClass="dropdown"></asp:DropDownList>
                            </td>
                        </tr>
                         <tr>
                            <td>
                                Tax Ledger :
                            </td>
                             <td>
                                <asp:DropDownList ID="ddlSaleTaxLedger" runat="server" CssClass="dropdown"></asp:DropDownList>
                            </td>
                        </tr>
                    </table>
                </div>               
                <div style="width:50%; float:right" align="left">
                <table style="width:98%; text-align:left;">
                    <tr>
                        <td style="width:70%">
                            Total Item
                        </td>
                        <td style="width:30%">
                            <asp:TextBox ID="txtTotalItemBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Pre Tax Total
                        </td>
                        <td>
                             <asp:TextBox ID="txtPreTaxBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Taxable Amount
                        </td>
                        <td>
                             <asp:TextBox ID="txtTaxableAmtBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            VAT/CST &nbsp;<asp:DropDownList ID="ddlVatBillLevel" Width="150px" CssClass="dropdown" runat="server" OnSelectedIndexChanged="ddlVatBillLevel_OnSelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                            <asp:HiddenField ID="hidTaxRateBillLevelMain" runat="server" />
                        </td>
                        <td>
                             <asp:TextBox ID="txtVatBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return false" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Post Tax Total
                        </td>
                        <td>
                             <asp:TextBox ID="txtPostTaxBillLevel" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);" AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Round off Amount
                        </td>
                        <td>
                             <asp:TextBox ID="txtRoundOffBillLevel" runat="server" CssClass="inputnumber" onKeyPress="return isNumberKey(this.id,event)" AutoCompleteType="Disabled" Text="0.00" onblur="return roundOff();"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Grand Total
                        </td>
                        <td>
                             <asp:TextBox ID="txtGrandTotalBillLevel" runat="server" CssClass="inputnumber" onkeydown="return EnabledTabKey(this.id, event);"  AutoCompleteType="Disabled" ></asp:TextBox>
                        </td>
                    </tr>
                    
                    </table>
                   </div> 
            </div>            
            <%--</ContentTemplate>           
             </asp:UpdatePanel>--%>    
             <div style="clear:both;"> &nbsp;</div>
            </div>        
                <div class="tab-content" ID="tabOtherBillLevel" runat="server">
                <%--<asp:UpdatePanel ID="UpdatePanel3" runat="server">
                <ContentTemplate>--%>                
                        <div style="width:100%">
                            <div style="width:48%; float:left; margin-right:4%">
                                <table style="width:100%">
                                    <tr>
                                        <td style="width:30%">
                                            Billing Address
                                        </td>
                                        <td style="width:70%">
                                            <asp:TextBox ID="txtBillAddress" runat="server" TextMode="MultiLine" CssClass="input" Width="97%" Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:30%">
                                            Delivery Address
                                        </td>
                                        <td style="width:70%">
                                            <asp:TextBox ID="txtDeliveryAdd" runat="server" TextMode="MultiLine" CssClass="input" Width="97%"  Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                     <tr>
                                        <td style="width:30%">
                                            Terms of Delivery
                                        </td>
                                        <td style="width:70%">
                                            <asp:TextBox ID="txtDeliveryTerms" runat="server" TextMode="MultiLine" CssClass="input" Width="97%"  Height="60px"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>                              
                            </div>
                            <div style="width:48%; float:left;">
                            <table style="width:100%">
                                    <tr>
                                        <td style="width:40%">
                                            Mode of Delivery
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtDeliveryMode" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Delivery Date
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtDeliveryDate" runat="server" Width="97%" CssClass="input" ValidationGroup="V"></asp:TextBox>
                                            <AjaxControl:CalendarExtender ID="extCal2" runat="server" TargetControlID="txtDeliveryDate" Format="dd/MM/yyyy" ></AjaxControl:CalendarExtender>
                                            <AjaxControl:MaskedEditExtender ID="maskDeliveryDate" runat="server" TargetControlID="txtDeliveryDate" MaskType="Date" Mask="99/99/9999" CultureName="en-GB"></AjaxControl:MaskedEditExtender>
                                            <AjaxControl:MaskedEditValidator ID="maskValidDelivery" InvalidValueMessage="Invalid Date" runat="server" ControlToValidate="txtDeliveryDate" ControlExtender="maskDeliveryDate" IsValidEmpty="true" ValidationGroup="V"></AjaxControl:MaskedEditValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Document NO.
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtDocumentNo" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Transporter Name
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtTransporter" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Vehicle Number
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtVehicle" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>                                   
                                    <tr>
                                        <td style="width:40%">
                                           <asp:Label ID="lblSalePerson" runat="server"></asp:Label>
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtSalesPerson" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Prepared By
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtPreparedBy" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Checked By
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtCheckedBy" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Authorized Signatory
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtSignatory" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Narration
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtNarration" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width:40%">
                                            Remarks
                                        </td>
                                        <td style="width:60%">
                                            <asp:TextBox ID="txtRemark" runat="server" Width="97%" CssClass="input"></asp:TextBox>
                                        </td>
                                    </tr> 
                                </table>
                            </div>
                        </div>                       
                
              <%--  </ContentTemplate>
              </asp:UpdatePanel> --%>
              <div style="clear:both">&nbsp;</div>
              </div>
       
            
         
           <div style="width:98%">
           <%--<asp:UpdatePanel ID="UpdatePanel4" runat="server">           
            <ContentTemplate> --%>           
            <table style="width:98%; text-align:center">
                <tr>
                    <td>
                        <asp:Button ID="btnSubmit" Text="Submit" runat="server" CssClass="button" OnClick="btnSubmit_OnClick" ValidationGroup="V"/> &nbsp;
                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CssClass="button" /> 
                    </td>
                </tr>
            </table> 
           <%-- </ContentTemplate>
            </asp:UpdatePanel>  --%>     
       </div>       
        </div>
        </asp:Panel> 
     </asp:Panel>
     
     <asp:Panel ID="PnlView" runat="server" Visible="false">
     <div style="width:80%; margin-left:10%; margin-right:10%">
     <asp:GridView ID="GrdSaleInvoice" runat="server"  CssClass="gridview" Width="80%" RowStyle-CssClass="gridviewitem"
     PagerStyle-CssClass="pgr"  AlternatingRowStyle-CssClass="gridview_alternate" AutoGenerateColumns="false" 
     EmptyDataRowStyle-CssClass="emptyrow" EmptyDataText="No Record Exist!" 
     >
     <Columns>
     <asp:TemplateField HeaderText="S.No" ItemStyle-HorizontalAlign="Center">
        <ItemTemplate> <%#Container.DataItemIndex+1%>     </ItemTemplate>
     </asp:TemplateField> 
     <asp:BoundField HeaderText="Invoice NO" DataField="invoiceno" />
     <asp:BoundField HeaderText="Customer" DataField="LNAME" />
      <asp:BoundField HeaderText="Date" DataField="TRNDATE" DataFormatString="{0:dd-MMM-yyyy}" />
     <asp:BoundField HeaderText="Amount" DataField="trntotal" ItemStyle-HorizontalAlign="Right" />
     <asp:TemplateField HeaderText="Details" ItemStyle-HorizontalAlign="Center" >
     <ItemTemplate>
     <a href="#" onclick="window.open('InventoryPrint/Saleinvoiceitemlevel.aspx?trnid=<%#DataBinder.Eval(Container.DataItem,"trnid")%>','','width=800,height=600,toolbar=no,status=yes,menubar=no,scrollbars=yes,resizable=yes')">View</a>                         

     </ItemTemplate>
     </asp:TemplateField>
     <asp:CommandField HeaderText="Edit" SelectText="<img src='../../Menu/images/Edit_user.png' alt='Edit'>" ShowSelectButton="true" />
     </Columns>
     </asp:GridView>
     </div>
     </asp:Panel>
</form>
</body>
</html>


